home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_13_02
/
small
/
formtemp.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1994-07-18
|
1KB
|
56 lines
/* Listing 6 */
/* formtemp.cpp -- use form templates */
/*
Generate declarations and definitions for
int max(int,int);
stack<char>
*/
#define max_TYPE int
#define stack_ITEM char
#define stack stack_strings
#include "def_gen.cpp"
/*
Generate declarations and definitions for
stack<int,10U>
*/
#define stack_ITEM int
#define stack_MAX_ITEMS 10U
#define stack stack_int_10U
#include "def_gen.cpp"
#include <iostream.h>
#include <iomanip.h>
main()
{
cout << "Which is greater? "
<< 4 << " or " << 5 << "?";
cout << " Answer: "
<< max(4,5) << "!" << endl;
stack_strings ToDo;
ToDo.push("wash car");
ToDo.push("cut grass");
ToDo.push("buy groceries");
ToDo.push("cash paycheck");
while (ToDo.top())
cout << ToDo.pop() << endl;
stack_int_10U CountDown;
for (int i = 1; CountDown.push(new int(i)); i++);
while (CountDown.top()) {
cout << *CountDown.top() << " ";
delete CountDown.pop();
}
cout << "Blast Off!" << endl;
return 0;
}